export function createReusableTemplate() {
  let render: ((props: any) => any) | undefined

  const DefineTemplate = {
    setup(_: unknown, { slots }: { slots: Record<string, (...args: any[]) => any> }) {
      return () => {
        render = slots.default
      }
    },
  }

  const UseTemplate = (props: any) => {
    if (typeof render === 'function') {
      return render(props)
    }
    return null
  }

  return [DefineTemplate, UseTemplate]
}
